var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var UI_Setting_UIBindings = require("AA_UI_Setting_UIBindings");
var UIView = require("AA_UIView");
var AudioManager = require("AA_AudioManager");
var LogManager = require("AA_LogManager");
var UIManager = require("AA_UIManager");
var BundleConfig = require("AA_BundleConfig");
var UIConfig_Home = require("AA_UIConfig_Home");
var GameConfig = require("AA_GameConfig");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;
var _def_UI_Setting = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.auto_ui = null;
    t.startX = 0;
    t.maxx = 395;
    t.minx = 0;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype._show = function (e) {
    var t = [];
    for (var o = 1; o < arguments.length; o++) {
      t[o - 1] = arguments[o];
    }
    this.initState();
  };
  _creator.prototype._clickListener = function (e) {
    var t = this.auto_ui;
    switch (e) {
      case t.btn_btclose:
      case t.btn_close:
        this._close();
    }
  };
  _creator.prototype.onLoad = function () {
    this.auto_ui.txt_idLabel.string = "";
    YPSDK.Platform.loginData && YPSDK.Platform.loginData.userUid && (this.auto_ui.txt_idLabel.string = "ID:" + YPSDK.Platform.loginData.userUid);
    GameConfig.default.appConfig && GameConfig.default.appConfig.Version && (this.auto_ui.txt_versionLabel.string = "当前版本：" + GameConfig.default.appConfig.Version);
  };
  _creator.prototype.onEnable = function () {
    this.auto_ui.node_yinxiaoHk.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
    this.auto_ui.node_yinxiaoHk.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
    this.auto_ui.node_yinyueHk.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
    this.auto_ui.node_yinyueHk.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
  };
  _creator.prototype.onTouchStart = function (e) {
    this.startX = e.getLocationX();
    LogManager.LogMgr.debug("开始触摸");
  };
  _creator.prototype.onTouchMove = function (e) {
    LogManager.LogMgr.debug("触摸中");
    var t = e.getLocationX() - this.startX;
    var o = e.getCurrentTarget();
    (t > 0 && o.x < this.maxx || t < 0 && o.x > this.minx) && (o.x += t);
    o.x > this.maxx && (o.x = this.maxx);
    o.x < this.minx && (o.x = this.minx);
    var n = o.name;
    var i = o.x / this.maxx;
    if ("$node_yinxiaoHk" == n) {
      this.auto_ui.node_yinxiaopro.getComponent(cc.ProgressBar).progress = i;
      AudioManager.AudioMgr.setEffectVolume(i);
    }
    if ("$node_yinyueHk" == n) {
      this.auto_ui.node_yinyuepro.getComponent(cc.ProgressBar).progress = i;
      AudioManager.AudioMgr.setMusicVolume(i);
    }
    this.startX = e.getLocationX();
  };
  _creator.prototype.initState = function () {
    var e = AudioManager.AudioMgr.getSettingInfo().effectVolume;
    var t = AudioManager.AudioMgr.getSettingInfo().musicVolume;
    this.auto_ui.node_yinyueHk.x = this.maxx * t;
    this.auto_ui.node_yinxiaoHk.x = this.maxx * e;
    this.auto_ui.node_yinyuepro.getComponent(cc.ProgressBar).progress = t;
    this.auto_ui.node_yinxiaopro.getComponent(cc.ProgressBar).progress = e;
  };
  _creator.prototype.openDuiHuan = function () {
    UIManager.default.open(BundleConfig.BundleNames.Home, UIConfig_Home.UIView_Home.UI_DuiHuan);
  };
  _creator.prototype.onDisable = function () {};
  __decorate([_property(UI_Setting_UIBindings.default)], _creator.prototype, "auto_ui", undefined);
  return __decorate([_ccclass], _creator);
}(UIView.default);
exports.default = _def_UI_Setting;